import 'package:taonile/generated/json/base/json_field.dart';
import 'package:taonile/generated/json/announcement_list_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class AnnouncementListEntity {
  late int code = 0;
  late String msg;
  late AnnouncementListData data = AnnouncementListData();

  AnnouncementListEntity();

  factory AnnouncementListEntity.fromJson(Map<String, dynamic> json) =>
      $AnnouncementListEntityFromJson(json);

  Map<String, dynamic> toJson() => $AnnouncementListEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class AnnouncementListData {
  @JSONField(name: "current_page")
  late String currentPage;
  late List<AnnouncementListDataData> data = [];

  AnnouncementListData();

  factory AnnouncementListData.fromJson(Map<String, dynamic> json) =>
      $AnnouncementListDataFromJson(json);

  Map<String, dynamic> toJson() => $AnnouncementListDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class AnnouncementListDataData {
  late String id;
  late String title;
  @JSONField(name: "created_at")
  late String createdAt;
  @JSONField(name: "updated_at")
  late String updatedAt;
  late String content;

  AnnouncementListDataData();

  factory AnnouncementListDataData.fromJson(Map<String, dynamic> json) =>
      $AnnouncementListDataDataFromJson(json);

  Map<String, dynamic> toJson() => $AnnouncementListDataDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
